home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / spoc88.zip / LOOPS.ZIP / MC.BAS < prev    next >
BASIC Source File  |  1988-06-13  |  4KB  |  89 lines

  1. 1  '┌───────────────────────────────────────────────────────────────┐
  2. 2  '│                           MC.BAS                              │
  3. 3  '│                         VERSION 1.0                           │
  4. 4  '│                                                               │
  5. 5  '│                  Turbo Basic                │
  6. 6  '│        (C) Copyright 1987 by Borland International        │
  7. 7  '│                                                               │
  8. 8  '│ System Requirements:                                          │
  9. 9  '│   - DOS Version 2.0 or later                                  │
  10. 10 '│   - 320K                                                      │
  11. 11 '│                                                               │
  12. 12 '│ This program is a simple spreadsheet program that is provided │
  13. 13 '│ as an example of a simple application that can be done in     │
  14. 14 '│ Turbo Basic.  You are encouraged to study this program and    │
  15. 15 '│ make any enhancements and modifications that you might want.  │
  16. 21 '└───────────────────────────────────────────────────────────────┘
  17. 22
  18. 23 $DYNAMIC                ' All arrays are DYNAMIC
  19. 24 $STACK  10240           ' to prevent stack overflow
  20. 25
  21. 26 $INCLUDE "MC0.INC"      ' Global variables, named constant AND
  22. 27                         ' array definition
  23. 28
  24. 29 $INCLUDE "MC1.INC"      ' Miscellaneous commands AND utilities
  25. 30                         ' (Keyboard,screen,toggles)
  26. 31
  27. 32 $INCLUDE "MC2.INC"      ' Init, display & clear SpreadSheet grid
  28. 33
  29. 34 $INCLUDE "MC3.INC"      ' Display Cells; move around Spreadsheet
  30. 35
  31. 36 $INCLUDE "MC4.INC"      ' Load, Save AND Print a spreadsheet;
  32. 37                         ' display on-line manual; DOS shell
  33. 39
  34. 40 $INCLUDE "MC5.INC"      ' Procedures to evaluate formulas AND
  35. 41                         ' recalculate the SpreadSheet
  36. 42
  37. 43 $INCLUDE "MC6.INC"      ' Procedures to read, update AND format
  38. 44                         ' cells; Commands dispatcher
  39. 45
  40. 46 $INCLUDE "MC7.INC"      ' Some string functions
  41. 47
  42. 48 $INCLUDE "MC8.INC"      ' Procedures to Read/Write records to or
  43. 49                         ' from the Spreadsheet data structure
  44. 52 RANDOMIZE TIMER         ' init random number generator
  45. 53 Begintimer=TIMER       ' initial time
  46. 54
  47. 55 '┌────────────────────── MAIN PROGRAM ──────────────────────────┐
  48. 56
  49. 57  CALL Init
  50. 58  FileName$=FNGetCmd$
  51. 59  IF FNExists%(FileName$) THEN
  52. 60     CALL load
  53. 61  ELSE
  54. 62     CLS
  55. 63     CALL Grid
  56. 64     CALL GotoCell(GlobFX%, GlobFY%)
  57. 65  END IF
  58. 66
  59. 67  ' set up an LOOP UNTIL '/Q' command is chosen
  60. 68  DO
  61. 69    CALL ReadKBD(Ch$)
  62. 70    CALL IBMCh(Ch$)
  63. 71    SELECT CASE left$(Ch$,1)
  64. 72      CASE CHR$(5)                      '^E
  65. 73        CALL MoveUp
  66. 74      CASE CHR$(24), CHR$(10)           '^X, ^J
  67. 75        CALL MoveDown
  68. 76      CASE CHR$(4), CHR$(13)            '^D, ^M
  69. 77        CALL MoveRight
  70. 78      CASE CHR$(19)                     '^S
  71. 79        CALL MoveLeft
  72. 80      CASE CHR$(1)                      '^A
  73. 81        CALL MoveHome
  74. 82      CASE CHR$(6)                      '^F
  75. 83        CALL MoveEnd
  76. 84      CASE "/"                          ' Command Header
  77. 85        CALL Commands
  78. 86      CASE CHR$(%EditKey )              ' F2
  79. 87        CALL GetCell(GlobFX%, GlobFY%)
  80. 88      CASE ELSE
  81. 89        IF ( left$(Ch$,1) >= " " ) AND ( left$(Ch$,1) <= CHR$(255))
  82. 90          THEN CALL GetCell(GlobFX%, GlobFY%)
  83. 91        END IF
  84. 92    END SELECT
  85. 93  LOOP UNTIL CalcExit%
  86. 94
  87. 95  END
  88. 96 '└─────────────────────────── END MAIN PROGRAM ──────────────────┘
  89.